<template>
  <div class="app">
    <h2 class="title">Vue路由测试</h2>
    <!-- 导航区 -->
    <nav class="nav">
      <RouterLink :to="{path: '/home'}" class="nav-link" active-class="active">首页</RouterLink>
      <RouterLink :to="{name: 'newsName'}" class="nav-link" active-class="active">新闻</RouterLink>
      <RouterLink :to="{path: '/about'}" class="nav-link" active-class="active">关于</RouterLink>
    </nav>
    <!-- 路由展示区 -->
    <div class="content">
      <RouterView></RouterView>
    </div>
  </div>
</template>

<script lang="ts" setup name="App">
import { RouterView ,RouterLink} from 'vue-router'
</script>

<style scoped>
.app {
  max-width: 800px;
  margin: 20px auto;
  background-color: #ffffff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 30px;
}

.title {
  color: #2c3e50;
  text-align: center;
  margin-bottom: 30px;
  font-size: 28px;
}

.nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
}

.nav-link {
  text-decoration: none;
  color: #42b983;
  font-size: 16px;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.nav-link:hover {
  background-color: #42b983;
  color: white;
}

.content {
  background-color: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  min-height: 200px;
  text-align: center;
  color: #666;
}

.active {
  background-color: #42b983;
  color: white;
}
</style>